<%--
    Document   : affichage_notes
    Created on : 24 juin 2011, 09:35:32
    Author     : elbeigni
--%>

<%@page import="bdd.beans.Note"%>
<%@page import="bdd.beans.Etudiant"%>
<%@page import="java.util.HashSet"%>
<%@page import="java.util.HashSet"%>
<%@page import="bdd.beans.Examen"%>
<%@page import="beans.*" contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Note</title>
    </head>
    <body>
        <table BORDER="1">
        <tr>
            <td> Num de l'&eacute;tudiant </td>
            <%
                ArrayList<Examen> listeExamen =new ArrayList((ArrayList) request.getAttribute("listeExamen"));
                for(Examen e : listeExamen)
                { %>
                <td> <%=e.getLibelle()%> </td>
                <% }%>
        </tr>
                <%
                ArrayList<Etudiant> listeEtudiant =new ArrayList((ArrayList) request.getAttribute("listeEtudiant"));

                for(Etudiant e : listeEtudiant){%>
        <tr>
                <td> <%=e.getNumetudiant() %> </td>
                <%

                    for(Examen ex : listeExamen)
                    {
                        if (e.getNotes().size()>0)
                        {
                            for(Note n : e.getNotes())
                            {%>
                                <form name="session" method="post" action="./ListeNotesECEnsServlet">
                                    <input type="hidden" name="EC" value="<%=request.getParameter("EC") %>"/>
                                    <input type="hidden" name="promotion" value="<%=request.getParameter("promotion") %>"/>
                                <td>
                                    <input type="hidden" name="numeroExamen" value="<%=ex.getNumexamen() %>"/>
                                    <input type="hidden" name="numeroEtudiant" value="<%=e.getNumetudiant() %>"/>
                                    <input type="texte" size="4" maxlength="5" name="noteEtudiant" value="<%=n.getNote() %>" >
                                    <input type="submit" name="modifierNote" value="Modifier" />
                                </td>
                                </form>
                            <%}
                        }
                        else
                        {%>
                                <form name="session" method="post" action="./ListeNotesECEnsServlet">
                                    <input type="hidden" name="EC" value="<%=request.getParameter("EC") %>"/>
                                    <input type="hidden" name="promotion" value="<%=request.getParameter("promotion") %>"/>
                                <td width=150> <input type="hidden" name="numeroExamen" value="<%=ex.getNumexamen() %>"/>
                                    <input type="hidden" name="numeroEtudiant" value="<%=e.getNumetudiant() %>"/> <input type="texte" size="4" maxlength="5" name="noteEtudiant"> <input type="submit" name="ajouterNote" value="Ajouter" /></td>
                                </form>
                     <%}}%>
              </tr>
                
                <%
                }%>
      </table>
                <%
        if(request.getAttribute("test")=="-1")
        {
            out.print("Erreur : La note doit &ecirc;tre comprise entre 0 et 20.");
        }
        %>

    </body>
</html>
